package ar.com.contable.ganancias.listener;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;

import ar.com.contable.ganancias.modelVO.ItemVO;

public class ItemPropertySource implements IPropertySource {

	private final ItemVO item;

	public ItemPropertySource(ItemVO todo) {
		this.item = todo;
	}

	@Override
	public boolean isPropertySet(Object id) {
		return false;
	}

	@Override
	public Object getEditableValue() {
		return this;
	}

	@Override
	public IPropertyDescriptor[] getPropertyDescriptors() {
	    return new IPropertyDescriptor[] {
		        new TextPropertyDescriptor("detalle", "Detalle"),
		        new TextPropertyDescriptor("valor", "Valor") };
	}


	  @Override
	  public Object getPropertyValue(Object id) {
		  System.out.println(id);
	    if (id.equals("detalle")) {
	      return this.toString();
	    }
	    if (id.equals("valor")) {
	      return this.item.getValue("enero");
	    }
	    return null;
	  }
	@Override
	public void resetPropertyValue(Object id) {

	}

	@Override
	public void setPropertyValue(Object id, Object value) {

	}

}
